﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DTO;
using DAO;
using System.Data;
namespace BUS
{
    public class MatHangBUS
    {
       // ------------- LOI ------------
        public List<MatHangDTO> LayDanhSachMatHangL()
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.LayDanhSachMatHangL();
        }
        public List<MatHangDTO> LayDanhSachTenMatHangL()
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.LayDanhSachTenMatHangL();
        }
        public List<XuatXuDTO> LayXuatXuTheoMatHangL(int maMH)
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.LayXuatXuTheoMatHangL(maMH);
        }
        public int LaySoLuongTheoMatHangL(int maMH, int maXX)
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.LaySoLuongTheoMatHangL(maMH, maXX);
        }
        public double LayGiaTheoMatHangL(int maMH, int maXX)
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.LayGiaTheoMatHangL(maMH, maXX);
        }
        public string LayTenMatHangTheoMaL(int maMH)
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.LayTenMatHangTheoMaL(maMH);
        }
        public int LayMaMatHangTheoTenL(string ten)
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.LayMaMatHangTheoTenL(ten);
        }
        public string CapNhatSoLuongL(int maMH, int maXX, int soluong, bool err)
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.CapNhatSoLuongL(maMH, maXX, soluong, err);
        }
        // END -------------- LOI ----------------
        //-----------------KIM----------------
        public List<MatHangDTO> KLayDanhSachMatHang()
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.KLayDSMH();
        }
        public List<MatHangDTO> KLayDanhSachTenMatHang()
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.KLayDanhSachTenMatHang();
        }
        public List<XuatXuDTO> KLayXuatXuTheoMatHang(int maMH)
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.KLayXuatXuTheoMatHang(maMH);
        }
        public string KLayTenMatHangTheoMa(int maMH)
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.KLayTenMatHangTheoMa(maMH);
        }
        public int KLayMaMatHangTheoTen(string ten)
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.KLayMaMatHangTheoTen(ten);
        }
        public string KCapNhatSoLuong(int maMH, int maXX, int soluong, bool err)
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.KCapNhatSoLuong(maMH, maXX, soluong, err);
        }
        public string KCapNhatGiaNhap(int maMH, int maXX, double gianhap, bool err)
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.KCapNhatGiaNhap(maMH, maXX, gianhap, err);
        }
        public double KLayGiaTheoMatHang(int maMH, int maXX)
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.KLayGiaTheoMatHang(maMH, maXX);
        }
        //END---------------KIM----------------
        //--------------------HAI----------

        public List<MatHangDTO> LayDanhSachMatHang()
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.LayDSMH_H();
        }
        public List<MatHangDTO> LayDanhSachTenMatHang()
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.LayDanhSachTenMatHang();
        }
        public List<XuatXuDTO> LayXuatXuTheoMatHang(int maMH)
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.LayXuatXuTheoMatHang(maMH);
        }
        public int LaySoLuongTheoMatHang(int maMH, int maXX)
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.LaySoLuongTheoMatHang(maMH, maXX);
        }
        public double LayGiaTheoMatHang(int maMH, int maXX)
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.LayGiaTheoMatHang(maMH, maXX);
        }
        public string LayTenMatHangTheoMa(int maMH)
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.LayTenMatHangTheoMa(maMH);
        }
        public int LayMaMatHangTheoTen(string ten)
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.LayMaMatHangTheoTen(ten);
        }
        public string CapNhatSoLuong(int maMH, int maXX, int soluong, bool err)
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.CapNhatSoLuong(maMH, maXX, soluong, err);
        }
        public int LayMaMatHang()
        {
            MatHangDAO mhDAO = new MatHangDAO();
            return mhDAO.LayMaMatHang();
        }
        MatHangDAO mh = new MatHangDAO();
        public DataTable DataMatHang()
        {
            return mh.MatHang();
        }
        public void insert(MatHangDTO h)
        {
            mh.insertmh(h);
        }
        public void delete(int h)
        {
            mh.delete(h);
        }
        public void update(MatHangDTO h)
        {
            mh.updatemh(h);
        }
        //-------------------END HAI--------------
    }
}
